package com.hbqyml.controller;

import com.hbqyml.common.core.controller.BaseController;
import com.hbqyml.common.core.domain.AjaxResult;
import com.hbqyml.common.core.page.TableDataInfo;
import com.hbqyml.domain.vo.EnterpriseXcxVo;
import com.hbqyml.service.IEnterpriseXcxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 企业信息Controller
 * 
 * @author houyutong
 * @date 2022-03-22
 */
@Api("小程序首页")
@RestController
@RequestMapping("/xcx/enterprise")
public class EnterpriseXcxController extends BaseController
{
    @Autowired
    private IEnterpriseXcxService enterpriseXcxService;


    /**
     * 查询企业信息列表
     */
    @ApiOperation("获取企业信息列表")
    @PostMapping("/list")
    public TableDataInfo list(@RequestParam(name = "region", required = false) Integer region,
                              @RequestParam(name = "classify", required = false) Integer classify,
                              @RequestParam(name = "search",required = false) String search) {
        startPage();
        List<EnterpriseXcxVo> list = enterpriseXcxService.selectXcxList(region,classify,search);
        return getDataTable(list);
    }

    /**
     * 获取企业信息详细信息
     */
    @ApiOperation("获取企业信息详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return AjaxResult.success(enterpriseXcxService.selectEnterpriseXcxById(id));
    }

    /**
     * 获取全部分类
     * @return
     */
    @ApiOperation("获取全部分类")
    @GetMapping("/getClassifyList")
    public AjaxResult getClassifyList() {
        return AjaxResult.success(enterpriseXcxService.getClassifyList());
    }

    /**
     * 获取地区
     * @return
     */
    @ApiOperation("获取所有地区")
    @ApiImplicitParam(name = "area", value = "区域id", dataType = "Integer", dataTypeClass = Integer.class)
    @GetMapping("/getAllArea")
    public AjaxResult getAllArea(@RequestParam(value = "area")Integer area) {
        return AjaxResult.success(enterpriseXcxService.getAllArea(area));
    }

    /**
     * 新增企业信息
     */

    /*@PostMapping
    public AjaxResult add(@RequestBody EnterpriseXcx enterpriseXcx)
    {
        return toAjax(enterpriseXcxService.insertEnterpriseXcx(enterpriseXcx));
    }*/
    /**
     * 修改企业信息
     */
    /*@PutMapping
    public AjaxResult edit(@RequestBody EnterpriseXcx enterpriseXcx)
    {
        return toAjax(enterpriseXcxService.updateEnterpriseXcx(enterpriseXcx));
    }*/

    /**
     * 删除企业信息
     */
	/*@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(enterpriseXcxService.deleteEnterpriseXcxByIds(ids));
    }*/
}
